package vek.Objects;

import java.awt.Point;
import java.util.ArrayList;
import java.util.Observable;
import vek.XML.parsedObjects.ParsedPOI;

/**
 * This class represents the Points of Interest which are shown on the map.
 * A point of interest is a sight that you can see in a city, it can be a store, a museum or a restaurant.
 * This class is used both a type, where all the classes that extend this class automatically are of this type, and thus can be used polymorphically.
 * However, the class is also used to specify the data which the part of the XML file that goes from < poi > to < /poi> contains.
 * This class has all the methods which the extended classes use, however some of them always return false and thus must be overriden in the subclasses.
 * This class, however, only contains the data about the POI and does not specify how the POI is to be shown in the GUI.
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public abstract class POI extends Observable{
    
    protected String name;
    protected String type;
    protected int coordinateX;
    protected int coordinateY;
    protected Point location;
    protected String poiicon1;
    protected String poiicon2;
    protected String lastUpdated;
    
    public POI()
    {
        
    }
    
    /**
     * Creates a new POI object based on a ParsedPOI object which contains the same variables, but not the same methods.
     * @param ppoi the ParsedPOI object which contains the data of this object
     */
    
    public POI(ParsedPOI ppoi)
    {
        name = ppoi.name;
        type = ppoi.type;
        coordinateX = ppoi.coordinateX;
        coordinateY = ppoi.coordinateY;
        location = new Point(coordinateX, coordinateY);
        poiicon1 = ppoi.poiicon1;
        poiicon2 = ppoi.poiicon2;
        lastUpdated = ppoi.lastUpdated;
    }
    
    /**
     * Gets this POI as a string. This is used to show the POI in the RightPanel in the GUI
     * @return the name and the type of this POI
     */
    
    public String toListString()
    {
        return name + " (" + type + ")"; 
    }
    
    /**
     * Gets this POI as a String
     * @return the name, type, x coordinate and y coordinate of this POI 
     */
    
    public String toString()
    {
        return "name: " + name + " type: " + type + " cordX: " + coordinateX + " cordY " + coordinateY;
    }
    
    /**
     * Gets the name of this POI
     * @return the name of this POI
     */
    
    public String getName()
    {
        return name;
    }
    
    /**
     * Gets the type of this POI
     * @return the type of this POI
     */
    
    public String getType()
    {
        return type;
    }
    
    /**
     * Gets the location, that is the x, y coordinate in pixels of this POI.
     * This is used to position the POI on the map
     * @return the location of this POI on the map as a Point, containing x and y coordinates
     */
    
    public Point getLocation()
    {
        return location;
    }
    
    /**
     * Gets the X coordinate of this POI
     * @return the x coordinate of this POI
     */
    
    public int getXCoordinate()
    {
        return coordinateX;
    }
    
    /**
     * Gets the Y coordinate of this POI
     * @return the Y coordinate of this POI
     */
    
    public int getYCoordinate()
    {
        return coordinateY;
    }
    
    /**
     * Gets the icon which is to be used when this POI is nor pressed on the map
     * @return the file name of this icon
     */
    
    public String getNotPressedIcon()
    {
        return poiicon1;
    }
    
    /**
     * Gets the icon which is to be used when this POI is pressed on the map
     * @return the file name of this icon
     */    
    
    public String getPressedIcon()
    {
        return poiicon2;
    }
    
    public String getLastUpdated()
    {
        return lastUpdated;
    }
    
    /**
     * Gets the type of this POI. 
     * 
     * NOTE: This method is NOT case sensitive
     * 
     * @param s the string which the type must equal to return true
     * @return true if the specified type equals the type of this POI, not case sensitive
     */
    
    public boolean typeEquals(String s)
    {
        if(type.equalsIgnoreCase(s))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    /**
     * Checks if this POI's type starts with the specified string
     * NOTE: this method is NOT case sensitive
     * 
     * @param s the string which this POI's type should start with to return true
     * @return true if this POI's type starts with the specified string
     */
    
    public boolean typeStartsWith(String s)
    {
        if(type.toLowerCase().startsWith(s.toLowerCase()))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    //methods from POI attraction
    
    /**
     * Checks if this POI's phone number starts with the specified string.
     * Note that the phone number is a string, not a double/int
     * @param s the string which the POI's phone number must start with to return true
     * @return true if the POI's phone number starts with the specified string.
     */
    
    public boolean phonenumberStartsWith(String s)
    {
        return false;
    }
    
    /**
     * Checks if this POI is open on the specified day, hour and minute.
     * @param day the day which the POI is supposed to be open
     * @param hour the hour which the POI is supposed to be open
     * @param minute the minute which the POI is supposed to be open
     * @return true if the POI is open at the specified time
     */
    
    public boolean isOpen(int day, int hour, int minute)
    {
        return false;
    }
    
    /**
     * Gets this POI's addresse
     * @see Addresse
     * @return this POI's Addresse
     */
    
    public Addresse getAddresse()
    {
        return null;
    }
    
    /**
     * Gets this POI's phone number
     * @return this POI's phone number
     */
    
    public int getPhoneNumber()
    {
        return -1;
    }
    
    /**
     * This website should be the POI's website and should show some information about this POI.
     * @return the url to the website connected to this POI
     */
    
    public String getURL()
    {
        return null;
    }
    
    /**
     * Gets the url to the website which is to be shown the POI is clicked in the GUI.
     * @return the url which is shown when this POI is clicked and the info about this POI is shown in the GUI
     */
    
    public String getURLShown()
    {
        return null;
    }
    
    /**
     * Gets the email of this POI
     * @return the email of this POI as a String
     */
    
    public String getEmail()
    {
        return null;
    }
    
    /**
     * Gets the opening hours for this POI
     * @see Openinghours
     * @return the opening hours for this POI
     */
    
    public Openinghours getOpeninghours()
    {
        return null;
    }
    
    /**
     * Gets the description of this POI.
     * The description is shown when this POI is clicked in the GUI
     * @return the description of this POI
     */
    
    public String getDescription()
    {
        return null;
    }
    
    /**
     * Checks if this POI has toilets
     * @return true if this POI has toilets
     */
    
    public int hasToilets()
    {
        return -1;
    }
    
    /**
     * Checks if this POI has elevators
     * @return true if this POI has elevators
     */
    
    public int hasElevators()
    {
        return -1;
    }
    
    /**
     * Checks if this POI is handicap friendly.
     * Handicap friendly should signify that the POI is accessible to the handicapped
     * @return 1 if handicap friendly, 0 if not, -1 if POI does not have data about this
     */
    
    public int isHandicapFriendly()
    {
        return -1;
    }
    
    //POI NonComercial methods
    
    // POI Comercial methods
    
    /**
     * Checks if this POI has at least one product where the name starts with the specified string
     * @see Product
     * @param s the string which at least one of the POI's products should start with to return true
     * @return true if at least one of the products of this POI starts with the specified String.
     */
    
    public boolean hasProductNameWhichStartsWith(String s)
    {
        return false;
    }
    
    /**
     * Gets the products of this POI.
     * @see Product
     * @return an ArrayList containg the products of this POI
     */
    
   public ArrayList<Product> getProducts()
    {
        return null;
    }
   
   /**
    * Checks if at least one of the POI's sold produts starts with the given string
    * @param s the string which at least one of the sold products should start with to return true
    * @return true if at least one of the products sold starts with the specified string
    */
   
   public boolean hasTypeOfProductSold(String s)
    {
        return false;
    }
   
   /**
    * Checks if the POI has at least one of POI's products sold's type which starts with the specified String
    * @param s part of the type which at least one of the POI's products sold's type should start with to return true
    * @return true if at least one of the POI's products sold's type starts with the specified string
    */
   
   
   public boolean hasTypeOfProductSoldStartsWith(String s)
    {
        return false;
    }
   
   /**
    * Gets the types of products sold
    * @return an ArrayList of the types of products sold by this POI
    */
   
    public ArrayList<String> getTypesOfProductsSold()
    {
        return null;
    }
    
    /**
     * Checks if this POI has the specified product.
     * @see Product
     * @param p the product which this POI should have to return true 
     * @return true if this POI has this product
     */
    
    public boolean hasProduct(Product p)
    {
        return false;
    }
    
    // POI Restaurant methods
    
    /**
     * Gets the types of food sold by this POI
     * @return an ArrayList containg the types of food sold by this POI
     */
    
    public ArrayList<String> getTypesOfFoodSold()
    {
        return null;
    }
    
    /**
     * Checks if the POI has types of food which starts with the specified string
     * @param s the string which at least one of the POI's types of food must start with to return true
     * @return true if at least one of the POI's types of food sold starts with the specified string
     */
    
    public boolean hasTypesOfFoodStartsWith(String s)
    {
        return false;
    }
    
    // POI Museum methods
    
    /**
     * Gets the types of exhibitions for this POI
     * @return the exhibitions of this POI
     */
    
    public ArrayList<String> getTypesOfExhibitions()
    {
        return null;
    }
    
    /**
     * Checks if the POI has at least one type of exhibition which starts with the specified string
     * @param s the string which at least one of the types of exhibtitions must start with to return true
     * @return true if at least one of the types of exhibtions start with the specified string.
     */
    
    public boolean hasTypesOfExhibitionsStartsWith(String s)
    {
       return false;
    }
    
}